#include <fstream>
#include <vector>
#include <string>


class big_int
{
	std::vector<int> big_integer;
public:
	big_int(std::string string);
	big_int(){};
	bool equals_zero();
	void resize(int new_size);
	int more_than(big_int &b);
	int size();
	big_int substract(big_int &a);
	big_int multiply(int &n);
	std::pair<big_int, big_int> divide_by(big_int divisor);
	std::string to_string();
	int & big_int::operator [] (size_t i) { return big_integer[i]; }
};

int big_int::size()
{
	return big_integer.size();
}

void big_int::resize(int n)
{
	big_integer.resize(n);
}

int big_int::more_than(big_int &b)
{
	if (size() != b.size())
		return size() - b.size();
	for (int i = size() - 1; i >= 0; i--)
	{
		if (big_integer[i] != b[i])
			return (big_integer[i] - b[i]);
	}
	return 0;
}

big_int::big_int(std::string string)
{
	for (size_t i = 1; i <= string.length(); i++)
	{
		big_integer.push_back(string[string.length() - i]- '0');
	}
}

std::string big_int::to_string()
{
	std::string tmp = "";
	char ch;
	for (int i = 0; i < size(); i++)
	{
		int m;
		m = big_integer[size() - i - 1];
		ch = (m + '0');
		tmp += ch;
	}
	return tmp;
}

bool big_int::equals_zero()
{
	for (int i = 0; i < size(); i++)
	{
		if (big_integer[i] != 0)
			return false;
	}
	return true;
}

big_int big_int::substract(big_int &a)
	{
		big_int result = *this;
	    for (int i = 0; i < a.size(); i++)
		{
			result[i] -= a.big_integer[i];
			if (result.big_integer[i] < 0)
				{
					result[i] += 10;
					result[i + 1]--;
				}
	    }
		int pos = result.size()-1;
		while ((pos>0) && !result.big_integer[pos])
			pos--;
		result.resize(pos+1);
	    return result;
	}

big_int big_int::multiply(int &n)
   {
      big_int res;
      res.resize(size()+1);
      big_integer.resize(size()+1);
      int r = 0;
      for (int i = 0; (i < res.size()) || r; i++)
      {
         res[i] = abs(big_integer[i] * n) + r;
         r = res[i] / 10;
         res[i] -= r*10;
      }
      while ((res.size()>0) && (!res[res.size()-1]))
         res.resize(res.size()-1);
      big_integer.resize(size()-1);
      return res;
   }

std::pair<big_int, big_int> big_int::divide_by(big_int a)
{
	
      big_int result;
      big_int current;
      result.resize(size());
      big_int divisor = a;
      int x;
      for (int i = size() - 1; i >= 0; --i)
      {
         current.resize(current.size()+1);
         for (int j = current.size()-1; j >= 1; j--)
            current[j]=current[j-1];
         current[0] = big_integer[i];
         if (current.equals_zero())
            break;
         int pos = current.size()-1;
         while (pos > 0 && !current[pos])
            pos--;
         current.resize(pos+1);
         int l = 0, r = 10;
         x = 0;
         while (l <= r)
         {
            int m = (l + r) >> 1;
			big_int c = divisor.multiply(m);
            if (c.more_than(current) <= 0)
            {
               x = m;
               l = m + 1;
            } else
               r = m - 1;
         }
      result[i] = x;
	  big_int dif = divisor.multiply(x);
	  current = current.substract(dif);
   } 
   int pos = result.size()-1;
   while (pos > 0 && !result[pos])
      pos--;
   result.resize(pos+1);
   pos = current.size()-1;
   while (pos > 0 && !current[pos])
      pos--;
   current.resize(pos+1);
   return std::make_pair(result, current);
}

int main()
{
	std::ifstream input("in.txt");
	std::ofstream output("out.txt");
	std::string s1, s2;
	while (input >> s1 >> s2)
	{
		big_int dividend = big_int(s1);
		big_int divisor = big_int(s2);
	
		if (divisor.equals_zero())
		{
			output << "<error>\n\n\n";
		}
		else
		{
			std::pair<big_int, big_int> result = dividend.divide_by(divisor);
			output << result.first.to_string() << "\n" << result.second.to_string() << "\n\n";
		}
	}
	return 0;
}